/*
 * luabase.h
 *
 * Copyright (C) 2011 - Dr.NP
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */

/**
 * @version luabase.h 1.0.0
 * @package exts/luabase
 * @author Dr.NP <np@bsgroup.org>
 * @update 06/08/2011
 */

#ifndef BSP_EXT_LUABASE_H

#define BSP_EXT_LUABASE_H                       1

#include "bsp_utils.h"

// Definations
#define LUABASE_FUNC_ON_LOAD                    "bsp_on_load"
#define LUABASE_FUNC_ON_RELOAD                  "bsp_on_reload"
#define LUABASE_FUNC_ON_UNLOAD                  "bsp_on_unload"
#define LUABASE_FUNC_ON_CONN                    "bsp_on_conn"
#define LUABASE_FUNC_ON_CLOSE                   "bsp_on_close"
#define LUABASE_FUNC_ON_DATA                    "bsp_on_data"
#define LUABASE_FUNC_ON_ERROR                   "bsp_on_error"

#define LUABASE_CMD_HEARTBEAT                   0xFFFFFFFF

#define LUABASE_MAX_CMDBODY                     4194296

#define PKG_VALUE_TYPE_BYTE                     0x1
#define PKG_VALUE_TYPE_SHORT                    0x2
#define PKG_VALUE_TYPE_INT                      0x3
#define PKG_VALUE_TYPE_LONGLONG                 0x4
#define PKG_VALUE_TYPE_FLOAT                    0x5
#define PKG_VALUE_TYPE_STRING                   0x6
#define PKG_VALUE_TYPE_ARRAY_START              0xF0
#define PKG_VALUE_TYPE_ARRAY_END                0xF1
#define PKG_VALUE_TYPE_NULL                     0xFF
#define PKG_UNSUPPORTED_TYPE_KEY                "__UNSUPPORTED_DATA_TYPE_KEY__"

// Macros

// Structs

// Functions
int luabase_bsp_pack(lua_State *, struct abuff_t *);
int luabase_bsp_unpack(lua_State *, char *, size_t);

#endif  /* luabase.h */
